package Arrays;

import java.util.Scanner;

/**
 * 作者:hfj
 * 功能:回文数
 * 日期: 2024/6/29 9:40
 */
public class Replies {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入一个回文数:");
        int number = scanner.nextInt();
        System.out.println("是否为回文数:" + isPalindrome(number));
    }

    public static boolean isPalindrome(int number){
        String x = number + "";
        int j = x.length() - 1;
        for (int i = 0; i < x.length(); i++,j--) {
            if (x.charAt(i) != x.charAt(j) && i != j){
                return false;
            }
        }
        return true;
    }
}
